package com.a01_2021.thousandstimes.general.controller;

import com.a01_2021.thousandstimes.general.service.CredentialService;
import com.a01_2021.thousandstimes.utils.AjaxResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: thousandstimes
 * @description:
 * @author: FRQ
 * @create: 2021-04-02 16:11
 **/
@RestController
@RequestMapping("/credential")
public class CredentialController {

    @Autowired
    private CredentialService credentialService;

    //根据证书类别查询证书
    @PreAuthorize("hasAuthority('credential-getCredentialByCa')")
    @DS("master")
    @PostMapping("getCredentialByCa")
    @ResponseBody
    public AjaxResponse getCredentialByCa(String category) {
        return credentialService.getCredentialByCategory(category);
    }
}
